package com.example.my.meila.presenter;

import com.example.my.meila.api.BaseSubscriber;
import com.example.my.meila.api.ExceptionHandle;
import com.example.my.meila.entity.Good;
import com.example.my.meila.model.ModelFactory;
import com.example.my.meila.view.impl.GoodView;

/**
 * Created by My on 2016/10/31.
 */
public class GoodPresenter {

    public GoodView goodView;

    public GoodPresenter(GoodView goodView) {
        this.goodView = goodView;
    }


    public void getGoodData(){

        ModelFactory.getiGoodModel().getGoodData(new BaseSubscriber<Good>() {
            @Override
            public void onSuccess(Good good) {
                goodView.onSuccess(good);

            }

            @Override
            public void onFail(ExceptionHandle.ResponeThrowable e) {
                goodView.onFail(e);

            }

            @Override
            public void onFinished() {
                goodView.onFinish();

            }
        });
    }
}
